package com.jsyl.lwbk.business.mapper;

import com.jsyl.lwbk.business.domain.ChildProjectConfig;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ChildProjectConfigMapper {

    List<ChildProjectConfig> findList(@Param("childId") Long childId);

    /**
     * 获取解锁的项目编号
     *
     * @param childId
     * @return
     */
    List<String> findProjectCodes(@Param("childId") Long childId);

    int addCompleteTimes(@Param("childId") Long childId,
                         @Param("projectCodes") List<String> projectCodes);


    ChildProjectConfig selectOne(@Param("childId") Long childId,
                                 @Param("projectCode") String projectCode);

    /**
     * 统计总完成次数
     *
     * @param childId
     * @param projectCode
     * @return
     */
    int sumProjectTimes(@Param("childId") Long childId,
                        @Param("projectCode") String projectCode);

    /**
     * 统计指定项目达到目标次数的个数
     *
     * @param childId
     * @param projectCode
     * @param targetTimes
     * @return
     */
    int countProjectTimes(@Param("childId") Long childId,
                          @Param("projectCodes") List<String> projectCode,
                          @Param("targetTimes") Integer targetTimes);

    int update(ChildProjectConfig childProjectConfig);

    int addReplaceTimes(@Param("childId") Long childId,
                        @Param("projectCode") String projectCode);

    int insert(ChildProjectConfig childProjectConfig);

    int selectCount(@Param("childId") Long childId);

    int selectCountByProjectCode(@Param("childId") Long childId,@Param("projectCode") String projectCode);

    int batchInsert(@Param("values") String values);


    ChildProjectConfig getProjectInfo(@Param("childId") Long childId,
                                      @Param("projectCode") String projectCode,
                                      @Param("age") Integer age);


    List<ChildProjectConfig> listCompleteTimeByCourse(@Param("childCourseId") Long childCourseId,
                                                      @Param("projectCodes") List<String> projectCodes,
                                                      @Param("childIds") List<Long> childIds);


    List<ChildProjectConfig> listCompleteTimesByCode(@Param("childId") Long childId,
                                              @Param("projectCodes") List<String> projectCodes);


    List<ChildProjectConfig> listAllCompleteTimes(@Param("childId") Long childId);


}
